﻿/*************************************************
事件基本对象
author：Daixiwei
**************************************************/
using System.Collections;
using System.Collections.Generic;

namespace taurus.client
{
    /// <summary>
    /// Event 类的属性包含有关事件的基本信息
    /// </summary>
    public class Event
    {
        /// <summary>
        /// 目标对象
        /// </summary>
        protected object target;
        /// <summary>
        /// 事件名
        /// </summary>
        protected string name;
        /// <summary>
        /// 消息参数
        /// </summary>
        protected Hashtable paramMap;

        public Event(string name)
        {
            this.name = name;
        }

        public Event(string name, object source)
        {
            this.target = source;
            this.name = name;
        }

        public object getTarget()
        {
            return this.target;
        }

        public string getName()
        {
            return this.name;
        }

        public void setTarget(object target)
        {
            this.target = target;
        }

        public void setName(string name)
        {
            this.name = name;
        }

        public object getParameter(string key)
        {
            object tem = paramMap[key];
            return tem;
        }

        public void setParameter(string key, object value)
        {
            if (paramMap == null) {
			    paramMap = new Hashtable();
            }
            paramMap[key] = value;
        }

        public override string ToString()
        {
            return "Event { Name:" + name + ", Source: " + target + ", Params: " + paramMap +" }";
        }
    }
}

